package com.eascs.bankAccount;

import com.eascs.admin.common.controller.BaseMasterViewController;
import com.eascs.app.dao.PageResult;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.view.ViewContext;
import com.eascs.site.view.button.AjaxConfirmButton;
import com.eascs.site.view.button.Button;
import com.eascs.tag.MenuTag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/bank/account")
public class BankAccountMgrController extends BaseMasterViewController {
	@Autowired
	BankAccountService bankAccountService;

	@Override
	public void preHandle() {
		super.preHandle();
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "bankAccountMgr");
	}

	@RequestMapping(value = "/mgr")
	public String bankAccountMgr(@RequestParam(defaultValue="0") Integer showPage) {
		String pageUrl = "/bank/account/mgr?";
		String[] titles = {"账号编号", "银行账户名称", "银行卡号","开户行", "备注" };

		PageResult<Object[]> pageResult = bankAccountService.page(showPage);

		AjaxConfirmButton button = new AjaxConfirmButton("删除",  "/bank/account/del?id=");
		button.setPermissionCode("bankAccountMgrDel");
		button.setConfirmMessage("确定删除?");
		Button[] detailButton = new Button[] {button };

		PaginationInfo paginationInfo = new PaginationInfo(pageResult, titles, pageUrl + "&showPage=");
		paginationInfo.setBuildPagingNavigation(true);
		paginationInfo.setMoreButtons(detailButton);
		paginationInfo.setBuildRowNumber(true);
		paginationInfo.setFirstRenderColumnIndex(1);
		ViewContext.put("paginationInfo", paginationInfo);

		return "/bank/bank_account_mgr";

	}

	
}
